package my.test.groups.common;

import java.util.ArrayList;

/**
 * @Author 许玉康
 * @Date 2019/9/6 13:22
 */
public class Branch implements IBranch {

    //存储子节点的信息
    private ArrayList<Object> subordinateList = new ArrayList<>();
    //树枝节点的名称
    private String name = "";
    //树枝节点的职位
    private String position="";
    //树枝节点的薪水
    private int salary = 0;

    public Branch(String name, String position, int salary) {
        this.name = name;
        this.position = position;
        this.salary = salary;
    }

    @Override
    public String getInfo() {
        return "名称:" + this.name + "\t职位:" + this.position + "\t薪水" + this.salary;
    }

    @Override
    public void add(IBranch branch) {
        this.subordinateList.add(branch);
    }

    @Override
    public void add(ILeaf leaf) {
        this.subordinateList.add(leaf);
    }

    @Override
    public ArrayList<Object> getSubordinateInfo() {
        return this.subordinateList;
    }
}
